﻿<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>个人-水处理系统</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link href="css/style.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="js/jquery-1.4.2.min.js">
</script>
<script type="text/javascript" src="js/jquery.form.js">
</script>
			
		<script>
function uploadImage() {
	jQuery(document)
			.ready(
					function() {
						var options = {
							url : "uploadFile",
							type : "POST",
							dataType : "script",
							success : function(msg) {
								if (msg.indexOf("#") > 0) {
									var data = msg.split("#");
									jQuery("#tipDiv").html(data[0]);
									jQuery("#showImage")
											.html(
													"<img src='file/"
															+ data[1]
															+ "' style='width:600px;height:450px;border:10px dashed #A5A5A5;margin-bottom:30px;margin-top:10px;'/>");
								} else {
									jQuery("#tipDiv").html(msg);
								}
							}
						};
						jQuery("#form2").ajaxSubmit(options);
						return false;
					});
}
function dosubmit() {
	var title = jQuery('#title').val();
	var fileupload = jQuery('#fileupload').val();
	if (title == "" || title == null || fileupload == "" || fileupload == null) {
		alert("请选择图片");
		return false;
	} else {
		jQuery("#form2").submit();
	}
	return true;
}
</script>
	</head>
	<body>
		<div class="main">
			<jsp:include page="conter/header.jsp"></jsp:include>
			<div class="certen">
				<jsp:include page="conter/deviceLeft.jsp"></jsp:include>
				<div class="content">
					<div class="mainbar">
						<div class="runbutton">
							<h2>
								<span style="letter-spacing: 20px; margin-left: 33px;">上传照片</span>
							</h2>
							<div class="clr"></div>
						</div>
						<div class="article">
							<form id="form2" action="addSlideImg" method="post"
								enctype="multipart/form-data">
								<div class="upload">
									<ol>
										<li>
											<label>
												标题：
											</label>
											<input type="text" class="text" id="title" name="title" />
										</li>
										<li>
											<label>
												浏览图片：
											</label>
											<input id="fileupload" name="fileupload" type="file"
												class="text" style="height: 28px;" />
										</li>
										<div id="tipDiv"></div>
										<li style="margin-left: 420px;">
											<input type="button" class="right-button02"
												onclick="uploadImage()" value="上传" />
										</li>
										<li>
											<input type="button" name="imageField"
												src="images/tijiao.jpg" class="send" onclick="dosubmit()"
												value="提交" />
											<input type="reset" src="images/raset.jpg" class="send1" />
										</li>
									</ol>
								</div>
							</form>

							图片预览
							<div id="showImage"></div>
						</div>
					</div>
					<div class="clr"></div>
				</div>
			</div>
	
	

		<script src="js/jquery.carouFredSel-6.0.4-packed.js"
			type="text/javascript">
</script>
			<div class="fbg" style="margin-top: -10px;">
				<div class="fbg_resize">	
					<jsp:include page="conter/slide.jsp"></jsp:include>
				</div>
			</div>
			<jsp:include page="conter/footer.jsp"></jsp:include>
		</div>

	</body>
	
</html>
